package com.mimi.util;

import com.mimi.enums.CodeEnum;

/**
 * @Author:徐向
 * @Description:
 * @Date: Created in 17:30 2017/10/18
 */
public class EnumUtil {
    public static <T extends CodeEnum> T getByCode(Integer code, Class<T> eunmClass) {
        for (T each: eunmClass.getEnumConstants()
             ) {
            if (code.equals(each.getCode())) {
                return each;
            }
        }
        return null;
    }
}
